<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>



    <style>
       li{
        height: 30px;
        border: 1px solid orange;
       }

    </style>

</head>
<body>
    <ul>
        <li class="itm">第一个</li>
        <li class="itm">第二个</li>
        <li class="itm">第三个</li>
        <li class="itm">第四个</li>
        <li class="itm">第五个</li>
        <li class="itm">第六个</li>
    </ul>

    

    <script>
        var lst=document.querySelectorAll(".itm")//根据class获取全部li
        
        for (var i = 0; i < lst.length; i++) {
       
            lst[i].addEventListener("click",function(){
                console.log(this);
            })
            
            
        }
    </script>


</body>
</html>